import _ from 'lodash'

export function List(ctx) {
  var list = [{
    field: 'name',
    width: '10%'
  }, {
    field: 'manufacture',
    width: '10%'
  }, {
    field: 'productModel',
    width: '10%'
  }, {
    field: 'ipaddr',
    width: '12%'
  }, {
    field: 'ptzStatus',
    width: '10%',
    show: function(item) {
      if (item.ptzStatus === 'enable' || item.ptzStatus === 'disable') {
        return ctx.$t(`onvif.${item.ptzStatus}`)
      } else {
        return ctx.$t(`onvif.checking`)
      }
    }
  }, {
    field: 'tag',
    width: '25%'
  }]

  _.forEach(list, (item) => {
    let keypath = 'list.' + item.field
    item.name = ctx.$t(keypath)
  })

  return list 
}